package edu.neu.cs6515.player;

import java.util.LinkedList;
import java.util.List;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import edu.neu.cs6515.player.strategy.AbstractStrategy;
import edu.neu.cs6515.xml.Placement;
import edu.neu.cs6515.xml.Tile;

/**
 * AbstractPlayer is the super class of all players that is created by 
 * a function of strategy
 * 
 * 
 */ 
@EqualsAndHashCode



public abstract class AbstractStrategyPlayer implements IPlayer {

    protected final AbstractStrategy strategy;
    @Getter
    protected List<Tile> tilesInHand = new LinkedList<Tile>();
    @Getter
    protected int numberOfPlayers = 0;
    @Getter
    protected final String playersName;
    @Getter
    protected List<String> nameOfOpponents = new LinkedList<String>();


    /**
     * which is a function of a IStrategy
     * 
     * @param playersName
     *            name of the player
     * 
     * @param strategy
     *            game strategy of the Player
     */
    public AbstractStrategyPlayer(final String playersName,
            final AbstractStrategy strategy) {
        super();
        this.strategy = strategy;
        this.playersName = playersName;
    }
    
    @Override
    public void registerAccepted(final int nbrOfPlayers,
            final List<Tile> tiles) {
        this.numberOfPlayers = nbrOfPlayers;
        tilesInHand = tiles;
    }

    /* (non-Javadoc)
     * @see edu.neu.cs6515.player.IPlayer#setPlayersInGameAndTilesInHand(java.util.List, java.util.List)
     */
    @Override
    public void setPlayersInGame(
            final List<String> playersStartGame) {
        this.nameOfOpponents = playersStartGame;
    }


    @Override
    public void recieveTurnBroadcast(final List<Placement> placementsInLastTurn, final String playerName) {
    }

    @Override
    public String toString() {
        return "Player [playersName=" + playersName + "]";
    }
}